package aop05;

import exception.SomeException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/3/8 14:59
 * Version:1.0-SNAPSHOT
 */
public class Test {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("aop05/spring.xml");
        SomeService someService = (SomeService) ac.getBean("someService");
        someService.doSome();
        System.out.println("****************************");
        someService.doSome("admin");
        System.out.println("****************************");
        someService.doSome("admin","alice");
        System.out.println("****************************");
        try {
            someService.doOther();
        } catch (SomeException e) {
        }
        System.out.println("****************************");
        someService.login("admin","123456");
        System.out.println("****************************");
        someService.register();
        System.out.println("****************************");
        OtherService otherService = (OtherService) ac.getBean("otherService");
        otherService.doSome();
        System.out.println("****************************");
        otherService.doOther();
        UserService userService = (UserService) ac.getBean("userService");
        System.out.println("****************************");
        userService.login();
        System.out.println("****************************");
        userService.register();
    }
}
